package com.vcms.cms.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.vcms.cms.dao.UserInfoDao;
import com.vcms.cms.entity.UserInfo;
import com.vcms.cms.service.LoginService;

@Service
public class LoginServiceImpl implements LoginService {

	private UserInfoDao userInfoDao;

	@Autowired
	public void setUserInfoDao(UserInfoDao userInfoDao) {
		this.userInfoDao = userInfoDao;
	}

	@Override
	public boolean checkLogin(UserInfo userInfo) {
		// 加密设置开始
		userInfo.setAccount(userInfo.getAccount());
		userInfo.setPsw(userInfo.getPsw());
		// 加密设置结束

		UserInfo u = userInfoDao.findByAccountAndPsw(userInfo);
		if (null != u && u.getUserInfoId() > 0) {
			return true;
		}
		return false;
	}

}
